package org.appmon.core.agent;

import java.lang.instrument.Instrumentation;

import org.appmon.core.agent.loader.AgentTracker;
import org.appmon.core.agent.loader.PostJvmAgentLoader;
import org.appmon.core.config.PackageBaseInfo;
import org.appmon.core.transformer.MethodCountTransformer;

public class CustomAgent {

	 private static Instrumentation instrumentation;
	 
	 
	

	
	    public static void premain(String args, Instrumentation inst) throws Exception {
	   
	        instrumentation = inst;
	        instrumentation.addTransformer(new MethodCountTransformer());
	    }

	
	    public static void agentmain(String args, Instrumentation inst) throws Exception {	    
	    //	AgentTracker.getInstance().hashCode();
	   //* 	System.out.println("My Agent Code : "+PackageBaseInfo.getInstance().hashCode());
	        instrumentation = inst;
	        instrumentation.addTransformer(new MethodCountTransformer());
	       
	    }

	    
	     //  Programmatic hook point.
	     
	    public static void initialize() {
	        if (instrumentation == null) {
	            PostJvmAgentLoader.loadAgent();	            
	        }
	    }

	
	
}
